package com.yanqu.road.entity.voucher.config;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 代金券信息
 */
public class VoucherConfigInfo extends DataObject {

    @FieldTypeAnnotation(desc = "代金券Id", update = true)
    private long voucherId;

    @FieldTypeAnnotation(desc = "代金券code")
    private String code;

    @FieldTypeAnnotation(desc = "代金券类型")
    private int type;

    @FieldTypeAnnotation(desc = "面值")
    private int price;

    @FieldTypeAnnotation(desc = "适用渠道")
    private List<Integer> channelId = new ArrayList<>();

    @FieldTypeAnnotation(desc = "开始时间")
    private long startTime;

    @FieldTypeAnnotation(desc = "结束时间")
    private long endTime;

    @FieldTypeAnnotation(desc = "兑换人")
    private long userId;

    @FieldTypeAnnotation(desc = "兑换时间")
    private long useTime;

    public long getVoucherId() {
        return voucherId;
    }

    public void setVoucherId(long voucherId) {
        if (this.voucherId != voucherId) {
            this.voucherId = voucherId;
            setUpdateOption();
        }
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        if (!Objects.equals(this.code, code)) {
            this.code = code;
            setUpdateOption();
        }
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        if (this.type != type) {
            this.type = type;
            setUpdateOption();
        }
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        if (this.price != price) {
            this.price = price;
            setUpdateOption();
        }
    }

    public List<Integer> getChannelId() {
        return channelId;
    }

    public void setChannelId(List<Integer> channelId) {
        if (channelId == null) {
            return;
        }
        this.channelId = channelId;
        setUpdateOption();
    }

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        if (this.startTime != startTime) {
            this.startTime = startTime;
            setUpdateOption();
        }
    }

    public long getEndTime() {
        return endTime;
    }

    public void setEndTime(long endTime) {
        if (this.endTime != endTime) {
            this.endTime = endTime;
            setUpdateOption();
        }
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setUpdateOption();
        }
    }

    public long getUseTime() {
        return useTime;
    }

    public void setUseTime(long useTime) {
        if (this.useTime != useTime) {
            this.useTime = useTime;
            setUpdateOption();
        }
    }
}
